//
//  TopView.m
//  test
//
//  Created by wangyang on 2018/8/9.
//  Copyright © 2018年 wangyang. All rights reserved.
//

#import "TopView.h"
#import "ViewController.h"
@import ReactiveObjC;

@interface TopView ()
@property(nonatomic, weak) ViewController *controller;
@end
@implementation TopView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
//        [self ];
        [[self rac_valuesAndChangesForKeyPath:@"controller.viewModel.likeCount" options:NSKeyValueObservingOptionNew observer:nil] subscribeNext:^(id x) {
            
            NSLog(@"%@",x);
            
        }];

    }
    return self;
}

- (IBAction)buttonClick:(id)sender {
    self.controller.viewModel.likeCount = 2;
}
@end
